package com.logicbus.backend.message.tools;

import com.anysoft.util.Properties;
import com.anysoft.util.PropertiesConstants;

/**
 * 主机mask工具
 */
public class HostMask {
    protected boolean hostMask = true;
    public HostMask(Properties props){
        hostMask = PropertiesConstants.getBoolean(props,"servant.hostmask",hostMask);
    }
    public String getHost(String host){
        return hostMask ? host.replaceFirst("\\d{1,}\\.\\d{1,}\\.\\d{1,}\\.","*.*.*."):host;
    }
}
